package com.jinxin.platform.cdperprotypay.controller;

import com.jinxin.platform.base.common.pojo.JsonResult;
import com.jinxin.platform.cdperprotypay.pojo.domain.ChargeItems;
import com.jinxin.platform.cdperprotypay.service.ChargeItemsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author : zhangpeng
 * @date : 2020-06-28 16:54:39
 **/
@RestController
@RequestMapping("charge/item")
public class ChargeItemsController {

    @Autowired
    private ChargeItemsService chargeItemsService;

    @PostMapping("/add")
    public JsonResult add(@RequestBody ChargeItems chargeItems){
        return chargeItemsService.insert(chargeItems);
    }

    @PostMapping("/update")
    public JsonResult update(@RequestBody ChargeItems chargeItems){
        return chargeItemsService.update(chargeItems);
    }

    @PostMapping("/del/{id}")
    public JsonResult del(@PathVariable("id") String id){
        return chargeItemsService.deleteById(id);
    }

    @PostMapping("/queryAll")
    public JsonResult queryAll(ChargeItems chargeItems){
        return chargeItemsService.queryAll(chargeItems);
    }

    @PostMapping("/queryById/{id}")
    public JsonResult queryById(@PathVariable("id") String id){
        return chargeItemsService.queryById(id);
    }

}
